package com.zl.service.impl;

import com.zl.dao.EasyBuyUserDao;
import com.zl.pojo.EasyBuyUser;
import com.zl.service.EasyBuyUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author ljm
 * @Date 2021/12/3 13:52
 */
@Service
public class EasyBuyUserServiceImpl implements EasyBuyUserService {
    @Autowired
    private EasyBuyUserDao ud;
    /**
     * 登录
     */
    @Override
    public EasyBuyUser login(EasyBuyUser easyBuyUser) {
        if(easyBuyUser.getLoginName() == null || "".equals(easyBuyUser.getLoginName()) || easyBuyUser.getPassword() == null || "".equals(easyBuyUser.getPassword())){
            easyBuyUser = null;
        }
        easyBuyUser=ud.login(easyBuyUser);
        System.out.println("EasyBuyUserServiceImpl   " + easyBuyUser);
        return easyBuyUser;
    }
    /**
     * 验证用户名是否重复
     */
    @Override
    public int regName(String loginName) {
        int flag = ud.regName(loginName);
        return flag;
    }
    /**
     * 注册用户
     */
    @Override
    public int regEasyBuyUser(EasyBuyUser easyBuyUser) {
        int flag = ud.regEasyBuyUser(easyBuyUser);
        return flag;
    }
    /**
     * 根据姓名查询用户
     */
    @Override
    public EasyBuyUser queryEasyBuyUserByName(String loginName) {
        EasyBuyUser easyBuyUser = ud.queryEasyBuyUserByName(loginName);
        return easyBuyUser;
    }
}
